//
//  YCComMacro.h
//  YCVillageDoctor
//
//  Created by zhangxiaoliang on 2017/6/7.
//  Copyright © 2017年 zhangxiaoliang. All rights reserved.
//

#ifndef YCComMacro_h
#define YCComMacro_h

//快速构造一个颜色UIColor对象
#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define kFontLite @"PingFang-SC-Light"
// rgb颜色转换（16进制->10进制）
#define HexColor(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
/**
 *  2.返回一个RGBA格式的UIColor对象
 */
#define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]

#define GrayColor(value) [UIColor colorWithRed:(value)/255.0 green:(value)/255.0 blue:(value)/255.0 alpha:1.0]
#define DividerColor GrayColor(238)
#define BackgroundColor GrayColor(243);
/**
 *  3.返回一个RGB格式的UIColor对象
 */
#define RGB(r, g, b) RGBA(r, g, b, 1.0f)

#pragma mark 屏幕的高和宽，物理宽度
// 屏幕尺寸
#define kScreenBounds [UIScreen mainScreen].bounds
#define kScreenSize [UIScreen mainScreen].bounds.size
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height

#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define kIPHONE6_HEIGHT 675

/** 设备类型 */
#define kDevice_iPhone4 (kScreenHeight <= 480.0)   //包括iPhone4 , iPhone4s
#define kDevice_iPhone5 ((kScreenHeight > 480.0) && (kScreenHeight <= 568.0))   //包括iPhone5,iPhone5s
#define kDevice_iPhone6 ((kScreenHeight > 568.0) && (kScreenHeight <= 667.0))   //iPhone6
#define kDevice_iPhone6Plus ((kScreenHeight > 667.0) && (kScreenHeight <= 736.0))   //iPhone6Plus
//字符串不为空
#define IS_NOT_EMPTY(string) (string !=nil && [string isKindOfClass:[NSString class]] && ![string isEqualToString:@""] && ![string isKindOfClass:[NSNull class]])
#define judgeString(key)  (IS_NOT_EMPTY(key))?([NSString stringWithFormat:@"%@",key]):(@"")
#define judgeStringWithLine(key)  (IS_NOT_EMPTY(key))?([NSString stringWithFormat:@"%@",key]):(@"  ")
#define judgeStringWithZero(key)  (IS_NOT_EMPTY(key))?([NSString stringWithFormat:@"%@",key]):(@"0")
//数字不为null
#define IS_NOT_NULL(number) ([number isKindOfClass:[NSNumber class]]&& ![number isKindOfClass:[NSNull class]])
#define judgeNumber(key)  ((IS_NOT_NULL(key))?key:@0)


#define kIPHONE6_HEIGHT 675
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))


#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)


//iphone6&iphone5宽的缩放比例
//用（原始iphone6长宽 * 这个宏） = iphone5长宽
#define kIphone5WProportion (1/320.0*kScreenWidth)

//iphone6Plus&iphone6sPlus宽的缩放比例
//用（原始长宽 * 这个宏）
#define Iphone6PlusWProportion (1/414.0*kScreenWidth)
//常见的颜色
#define BackgroundColor GrayColor(243);


#define BigTitleFont [UIFont systemFontOfSize:18.0]
#define TitleFont [UIFont systemFontOfSize:17.0]
#define SubTitleFont [UIFont systemFontOfSize:15.0]
#define LevelFont [UIFont systemFontOfSize:14.0]
#define AddressFont [UIFont systemFontOfSize:13.0]

#define GreenColor [UIColor colorWithHexString:@"0x2199f1"]

#define threeGray [UIColor colorWithHexString:@"333333"]
#define sixGray [UIColor colorWithHexString:@"666666"]
#define nineGray [UIColor colorWithHexString:@"999999"]

#define login_BackgroundColor [UIColor colorWithHexString:@"0x4183d7"]

#define Gray GrayColor(85)
#define LigthGray GrayColor(153)
#define GrayBorderColor GrayColor(235)
#define DividerColor GrayColor(238)
#define IncomePurpleColor [UIColor colorWithHexString:@"FC617B"]




#endif /* YCComMacro_h */
